/**
 * @filename:CourseDao Course
 * @project constract  V1.0
 * Copyright(c) 2018 gong Co. Ltd. 
 * All right reserved. 
 */
package com.znufe.exam.repository;

import java.util.List;

import com.github.pagehelper.PageInfo;
import com.znufe.exam.domain.Lecturer;
import com.znufe.exam.domain.course.CourseDirectoryObject;
import com.znufe.exam.domain.course.CoursePageResponseObject;
import com.znufe.exam.domain.course.CourseResponseObject;
import com.znufe.exam.viewmodel.student.course.CoursePageRequestVm;
import com.znufe.exam.viewmodel.student.course.CourseProjectRequestVm;
import com.znufe.exam.viewmodel.student.course.CourseSearchRequestVm;
import org.apache.ibatis.annotations.Mapper;
import com.znufe.exam.domain.Course;
import org.apache.ibatis.annotations.Param;

/**   
 *  
 * @Description:  课程表——DAO
 * @Author:       gong   
 * @CreateDate:   Course
 * @Version:      V1.0
 *    
 */
@Mapper
public interface CourseMapper extends BaseMapper<Course>{


	Course selectByPrimaryKey(Integer id);

    @Override
	int deleteByPrimaryKey(Integer id);

    @Override
	int insertSelective(Course course);

    @Override
	int updateByPrimaryKeySelective(Course course);
	
	List<Course> queryCourseList(Course course);

    /**
     *get根据级别查询4条相应课程
     * @param courseType
     * @param courseProject
     * @return
     */
	List<Course> queryCourseByProjectAndTypeLimit(@Param("courseProject") Integer courseProject,@Param("courseType") Integer courseType);

    /**
     * post根据级别查询4条相应课程
     * @param courseProject
     * @param courseType
     * @param orderByField
     * @return
     */
    List<Course> queryCourseByProjectAndType(@Param("courseProject") Integer courseProject,
                                      @Param("courseType") Integer courseType,
                                      @Param("orderByField") String orderByField);

    /**
     * 查看更多课程
     * @param requestVm
     * @return
     */
	List<Course> getCoursePageByType(CoursePageRequestVm requestVm);

    /**
     * 根据课程级别和名称查询课程
     * @param requestVm
     * @return
     */
    List<Course> queryCourseByTypeAndName(CourseSearchRequestVm requestVm);


    /**
     * 分页展示课程信息
     * @param requestVM
     * @return
     */
    List<CoursePageResponseObject> coursePage(CoursePageRequestVm requestVM);

    /**
     *根据项目类别、课程名称、课程类别查询课程
     * @param courseProject
     * @param courseName
     * @param courseType
     * @return
     */
    Course getCourseByProjectAndNameAndType(@Param("courseProject") Integer courseProject,
                                                  @Param("courseName") String courseName,
                                                  @Param("courseType") Integer courseType);

    List<CourseResponseObject> getCourseOutlineById(Integer courseId);

    List<CourseDirectoryObject> getCourseDirectoryById(Integer courseId);

    /**
     * 类别删除时，同时删除该类别所有课程
     * @param categoryId
     * @return
     */
    int deleteAllCourseByCategory(Integer categoryId);
}
